package hfu.pm.entities;

import java.util.Date;

import javax.persistence.*;

public class Room implements Comparable<Room>{
	@Id
	Long id;
	
	String name;
	boolean _private;

	Date lastActivity;
	Date timestamp;

	public Room() {
		timestamp = new Date(System.currentTimeMillis());
		lastActivity = new Date(System.currentTimeMillis());
	}

	public Long getId() {
		return id;
	}

	public boolean isPrivate() {
		return _private;
	}

	public void setPrivate(boolean _private) {
		this._private = _private;
	}

	public Date getTimestamp() {
		return timestamp;
	}

	public void setTimestamp(Date timestamp) {
		this.timestamp = timestamp;
	}
	
	public String getName() {
		return name;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
	public void setTimestamp() {
		this.timestamp = new Date(System.currentTimeMillis());
	}
	
	public void setLastActivity() {
		this.lastActivity = new Date(System.currentTimeMillis());
	}
	
	public Date getLastActivity() {
		return this.lastActivity;
	}

	@Override
	public int compareTo(Room o) {
		return o.lastActivity.compareTo(this.lastActivity);
	}
}
